package com.linkwings.dbTemp;

public class ParameterCheckUtil {
	
	public static void checkNotNull(String paramName,Object param) throws ParameterException{
		if(param==null){
			throw new ParameterException("The Parameter <"+paramName+"> must not null!");
		}
	}
	
	public static void checkPlusInteger(String paramName,int param,boolean inclueZero) throws ParameterException{
		if(inclueZero==true&&param<0){
			throw new ParameterException("The Parameter <"+paramName+"> must bigger or equal 0!");
		}
		if(inclueZero==false&&param<=0){
			throw new ParameterException("The Parameter <"+paramName+"> must bigger 0!");
		}		
	}
	
	public static void checkOffsetAndPagesize(int offset,int pageSize)throws ParameterException{
		checkPlusInteger("offset",offset,true);
		checkPlusInteger("pageSize",pageSize,false);
	}

}
